define
(
    ["require",
     "lib/knockout"],
    function (require, ko)
    {
        ko.bindingHandlers.rangeBind = 
        {
            init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext)
            {
                var allBindings = valueAccessor();
                element.min = allBindings.min();
                element.max = allBindings.max();
                element.value = allBindings.value();

                ko.utils.registerEventHandler(element, "change", function(event)
                {
                    var valueObservable = valueAccessor();
                    valueObservable.value(event.target.value);
                });
            }
        };
    }
);